/**
 * This program is free software but WITHOUT ANY WARRANTY OR CONDITIONS OF ANY KIND.
 *
 * Copyright (C) 2008-2013 www.pretty-tools.com
 */

window.thisWnd = null;
window.pageLoaded = false;
window.arguments = [];

chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
    if (request.arguments)
    {
        window.arguments = request.arguments;
        if (request.thisWnd)
            window.thisWnd = request.thisWnd;
        if (window.pageLoaded) // we need to start slide-show
            gSlideShow.onLoad();
    }
    if (request.additionalImages)
    {
        var count = gSlideShow.imgSources.length;
        gSlideShow.addImages(request.additionalImages);
        if (gSlideShow.imgSources.length > count && request.title)
            document.title = document.title + ", " + request.title;
    }
    sendResponse({});
});
